package module

import org.tellurium.dsl.DslContext

public class SimplifyUFModule extends DslContext {
	
	public void defineUi() {
		ui.Container(uid: "J_id16j_id18", clocator: [tag: "table", id: "j_id16:j_id18", class: "rich-toolbar richPanelBodyClass"]){
			UrlLink(uid: "UF", clocator: [tag: "a", text: "UF"])
		}
		
		ui.Form(uid: "J_id52", clocator: [tag: "form", action: "/simplify/private/pages/uf_edit.jsf", method: "post", name: "j_id52", id: "j_id52"]){
			Container(uid: "Table", clocator: [tag: "table"]){
				Container(uid: "Table", clocator: [tag: "table"]){
					InputBox(uid: "J_id52nome", clocator: [tag: "input", type: "text", name: "j_id52:nome", id: "j_id52:nome"])
					InputBox(uid: "J_id52sigla", clocator: [tag: "input", type: "text", name: "j_id52:sigla", id: "j_id52:sigla"])
					InputBox(uid: "J_id52id", clocator: [tag: "input", type: "text", name: "j_id52:id", id: "j_id52:id"])
				}
			}
			Container(uid: "J_id52j_id65", clocator: [tag: "table", direct: "true", id: "j_id52:j_id65", class: "rich-toolbar "]){
				UrlLink(uid: "Alterar", clocator: [tag: "a", text: "Alterar"])
				UrlLink(uid: "Inserir", clocator: [tag: "a", text: "Inserir"])
			}
		}
	
		ui.Form(uid: "Toolbar", clocator: [tag: "form", action: "/simplify/private/pages/uf_list.jsf", method: "post", name: "j_id44", id: "j_id44"]){
			SubmitButton(uid: "Novo", clocator: [tag: "input", type: "submit", value: "Novo", name: "j_id44:j_id50"])
			InputBox(uid: "J_id44nome", clocator: [tag: "input", type: "text", name: "j_id44:nome", id: "j_id44:nome"])
			SubmitButton(uid: "Pesquisar", clocator: [tag: "input", type: "submit", value: "Pesquisar", name: "j_id44:j_id49"])
			SubmitButton(uid: "ExibirFiltros", clocator: [tag: "input", type: "submit", value: "Exibir Filtros", name: "j_id44:j_id51"])
			SubmitButton(uid: "Limpar", clocator: [tag: "input", type: "submit", value: "Limpar", name: "j_id44:j_id52"])
		}
		
		ui.Container(uid: "Link", clocator: [tag: "a"], respond: ["click"]){
			Image(uid: "Editar", clocator: [tag: "img", direct: "true", title: "Editar"])
		}
	}
	
	public void abrirListagem(){		
		click "J_id16j_id18.UF"		
		waitForPageToLoad 30000
	}
	
	public void inserirDados(){		
		waitForPageToLoad 30000
		click "Toolbar.Novo"
		waitForPageToLoad 30000
		type "J_id52.Table.Table.J_id52nome", "Sao Paulo"
		type "J_id52.Table.Table.J_id52sigla", "SP"		
		click "J_id52.J_id52j_id65.Inserir"
		waitForPageToLoad 30000
	}
	
	public void alterarDados(){		
		click "Link.Editar"
		waitForPageToLoad 30000
		type "J_id52.Table.Table.J_id52nome","Minas Gerais"
		type "J_id52.Table.Table.J_id52sigla","MG"	
		click "J_id52.J_id52j_id65.Alterar"
	}
}